package com.bgs.travelapp.chat.controller;

import com.bgs.travelapp.chat.service.ChatRecordService;
import com.bgs.travelapp.result.CommonResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 前端---问答
 * gpd 2022-08-16 09点39分
 */
@RestController
@CrossOrigin
@RequestMapping("/chatRecord")
public class ChatRecordController {

    @Resource
    ChatRecordService chatRecordService;

    /**
     * 查询用户与客服的聊天记录
     * 前端---问答
     * gpd 2022-08-16 09点45分
     * @param fromUserName
     * @param toUserName
     * @return
     */
    @GetMapping("/getUserChatRecord")
    public CommonResult getUserChatRecord(String fromUserName,String toUserName){
        return CommonResult.ok(chatRecordService.getUserChatRecord(fromUserName,toUserName));
    }
}
